function lst = add(lst, varargin)
%ADD Adds elements to the list object
%
% [ Syntax ] 
%   - lst = add(lst, e)
%   - lst = add(lst, e1, e2, ...)
%
% [ Description ]
%   - lst = add(lst, e) adds a single element to the end of the list.
%
%   - lst = add(lst, e1, e2, ...) adds multiple elements to the end
%     of the list in the input order.
%
% [ History ] 
%   - Created by Dahua Lin, on Jan 5, 2008
%

%% main

if nargin == 2 % add single 
    
    if lst.n == numel(lst.items)  % grow if full
        lst = grow(lst);
    end
    
    lst.items{lst.n + 1} = varargin{1};
    lst.n = lst.n + 1;
    
else           % add multiple
    lst = append(lst, varargin);
    
end

